#include "EffectPool.h"

#include <fstream>

using std::ifstream;

void EffectPool::load(istream& input) {
	string effectName;
	int count;
	while (input >> effectName) {
		input >> count;

		pool.insert(map<string, Effect>::value_type(effectName, Effect()));

		Effect& effect = pool[effectName];

		for (int i = 0; i != count; i++) {
			effect.push_back(EffectSingle(input));
		}
	}
}

void SpellPool::load(istream& input) {
	string spellName;
	int actionPoint;
	string effectName;
	while (input >> spellName) {
		input >> effectName;
		input >> actionPoint;

		Effect& effect = effectPool.get(effectName);
		pool.insert(map<string, Spell>::value_type(spellName, Spell(effect, actionPoint)));
	}
}
